#include "stdafx.h"

#include "operators.h"

namespace funpl
{

namespace ast
{

// Gets information on the given operator.
operator_desc operator_info(operator_id::t id)
{
	using namespace operator_id;

	switch (id)
	{
	case member: return operator_desc(id, 71);
	case member_overload: return operator_desc(id, 71);

	case on: return operator_desc(id, 70, true, false, true);

	case evaluate: return operator_desc(id, 61, true, false, true);
	case index: return operator_desc(id, 61, true, false, true);

	case post_increment: return operator_desc(id, 61, true, false, true);
	case post_decrement: return operator_desc(id, 61, true, false, true);
	
	case dereference: return operator_desc(id, 60, true, true);
	case address: return operator_desc(id, 60, true, true);
	case move: return operator_desc(id, 60, true, true);
	
	case cast: return operator_desc(id, 60);

	case minus: return operator_desc(id, 60, true, true);
	case plus: return operator_desc(id, 60, true, true);
	case not: return operator_desc(id, 60, true, true);
	
	case pre_increment: return operator_desc(id, 60, true, true);
	case pre_decrement: return operator_desc(id, 60, true, true);
	
	case mul: return operator_desc(id, 51);
	case div: return operator_desc(id, 51);
	case mod: return operator_desc(id, 51);
	
	case add: return operator_desc(id, 50);
	case sub: return operator_desc(id, 50);
	
	case less: return operator_desc(id, 41);
	case greater: return operator_desc(id, 41);
	case less_equal: return operator_desc(id, 41);
	case greater_equal: return operator_desc(id, 41);
	
	case equal: return operator_desc(id, 40);
	case not_equal: return operator_desc(id, 40);
	
	case and: return operator_desc(id, 32);
	case xor: return operator_desc(id, 31);
	case or: return operator_desc(id, 30);
	
	case logical_and: return operator_desc(id, 21);
	case logical_or: return operator_desc(id, 20);
	
	case assign: return operator_desc(id, 10, false, true);

	case mul_assign: return operator_desc(id, 10, false, true);
	case div_assign: return operator_desc(id, 10, false, true);
	case mod_assign: return operator_desc(id, 10, false, true);
	
	case add_assign: return operator_desc(id, 10, false, true);
	case sub_assign: return operator_desc(id, 10, false, true);
	
	case and_assign: return operator_desc(id, 10, false, true);
	case or_assign: return operator_desc(id, 10, false, true);
	case xor_assign: return operator_desc(id, 10, false, true);

	default:
		LEAN_ASSERT(false);
	}

	return operator_desc(none, -1, false, false);
}

} // namespace

} // namespace